package service.Impl;

import dao.mapper.WishListLineMapper;
import org.apache.ibatis.session.SqlSession;
import service.IWishListLineService;
import utils.SqlSessionUtil;
import vo.WishListLine;

import java.util.List;

public class IWishListLineServiceImpl implements IWishListLineService {
    SqlSession sqlSession = new SqlSessionUtil().sqlSession;
    WishListLineMapper wishListLineMapper = sqlSession.getMapper(WishListLineMapper.class);
    @Override
    public void addWish(WishListLine wishListLine) {
        wishListLineMapper.addWish(wishListLine);
        sqlSession.commit();
    }

    @Override
    public void deleteWish(int id) {
        wishListLineMapper.deleteWish(id);
        sqlSession.commit();
    }

    @Override
    public List<WishListLine> getWishesByWishListId(int id) {
        List<WishListLine> wishes = wishListLineMapper.getWishListLines(id);
        return wishes;
    }
}
